package task;

public class Task4_9 {
    public static void main(String[] args) {
        int[] array = {1,2,6,4,5};
        int left = 0;
        int right = array.length - 1;
        for (int i = 0; i < array.length; i++) {
            while(array[left] % 2 == 1 &&left < right){
                left ++;
            }
            while(array[right] % 2 == 0 &&left < right){
                right --;
            }
            int tem = array[left];
            array[left] = array[right];
            array[right] = tem;
        }
        for (int i = 0; i < array.length; i++) {
            System.out.print(array[i] + " ");
        }


    }
}
